SHELL   = /bin/sh
CC      = gcc
LEX     = flex
LFLAGS  = --nounput
YACC    = bison
YFLAGS  = -dy
CTAGS   = cscope -bR

DEFS    = -DLOGGER_DEBUG
FLAGS   = -O2 -g
CFLAGS  = $(FLAGS) $(DEFS) -I..
LDLIBS  = -lGeoIP
LDFLAGS = $(FLAGS)

prefix  = /usr/local
bindir  = $(prefix)/bin

.SUFFIXES:
.SUFFIXES: .c .o

##### End of system configuration section. #####

HL_OBJS = $(addprefix ./, hl.o)
HL_SRCS = $(addprefix ./, hl.c hl.h)

#TEST_OBJS = $(addprefix test/, unit_tests.o)
#TEST_SRCS = $(addprefix test/, unit_tests.c)

#BINS = hldns-test
OBJS = $(TEST_OBJS) $(HL_OBJS)
SRCS = $(TEST_SRCS) $(HL_SRCS)

##### Phony rules

.PHONY: 	all
#all: 		hldns-test

.PHONY: 	tags
tags: 		$(SRCS)
			$(CTAGS) $(SRCS)

.PHONY: 	clean
clean:
			rm -rf $(BINS)
			rm -rf $(TEST_OBJS) $(HL_OBJS)

##### Producer rules

$(BINS): 	$(OBJS)
			$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

# EOF

